import { BaseModel } from './BaseModel.js';
import { dataFiles } from '../config/database.js';

const defaultColleges = [
  {
    id: 1,
    name: '计算机学院',
    totalStudents: 1200,
    totalClasses: 24,
    totalTeachers: 85,
    totalCounselors: 12,
    dean: '张院长',
    phone: '13800138001',
    email: 'cs@university.edu',
    address: '教学楼A座3楼',
    status: 'active',
    description: '专注于计算机科学与技术、软件工程等专业',
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString()
  },
  {
    id: 2,
    name: '软件学院',
    totalStudents: 800,
    totalClasses: 16,
    totalTeachers: 45,
    totalCounselors: 8,
    dean: '李院长',
    phone: '13800138002',
    email: 'se@university.edu',
    address: '教学楼B座2楼',
    status: 'active',
    description: '培养软件工程领域的专业人才',
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString()
  },
  {
    id: 3,
    name: '人工智能学院',
    totalStudents: 600,
    totalClasses: 12,
    totalTeachers: 35,
    totalCounselors: 6,
    dean: '王院长',
    phone: '13800138003',
    email: 'ai@university.edu',
    address: '教学楼C座4楼',
    status: 'active',
    description: '专注于人工智能、机器学习等前沿技术',
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString()
  },
  {
    id: 4,
    name: '数据科学学院',
    totalStudents: 500,
    totalClasses: 10,
    totalTeachers: 28,
    totalCounselors: 5,
    dean: '赵院长',
    phone: '13800138004',
    email: 'ds@university.edu',
    address: '教学楼D座2楼',
    status: 'active',
    description: '培养数据分析和数据科学专业人才',
    createdAt: new Date().toISOString(),
    updatedAt: new Date().toISOString()
  }
];

export class College extends BaseModel {
  constructor() {
    super(dataFiles.colleges, defaultColleges);
  }

  findByName(name) {
    return this.findOne({ name });
  }

  findByStatus(status) {
    const data = this.findAll();
    return data.filter(college => college.status === status);
  }
}